package com.oa.dao.impl;

import java.util.List;


import org.hibernate.Query;
import org.springframework.stereotype.Repository;


import com.oa.base.BaseDaoImpl;
import com.oa.dao.PageDao;
@SuppressWarnings({ "unchecked"})
@Repository("pageDao")
public class PageDaoImpl extends BaseDaoImpl<Object> implements PageDao{
	
	public <T> List<T> queryForpage(String hql, int offset, int length) {
			Query query = getSession().createQuery(hql).setFirstResult(offset)
					.setMaxResults(length);
			List<T> list = query.list();
		return list;
	}

	@SuppressWarnings("rawtypes")
	public int countAllRowCount(String hql) {
		return this.getSession().createQuery(hql).list().size();
	}

}
